package com.bazaaroid.server.gae.core.dto.partner;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;

import com.bazaaroid.server.gae.core.persistence.model.partner.Discount;

@XmlRootElement(name = "Discount")
public class DiscountDTO {

	private Discount discount = null;

	public DiscountDTO(){}

	public DiscountDTO(Discount discount) {
		this.discount = discount;
	}

	@XmlElement
	public String getKey() {
		return discount.getKey().toString();
	}

	@XmlElement
	public String getName() {
		return discount.getName();
	}

	@XmlElement
	public String getDescription() {
		return discount.getDescription();
	}

	@XmlElement
	public int getPercentage() {
		return discount.getPercentage();
	}

	@XmlElement
	public Double getPriceWithDiscount() {
		return discount.getPriceWithDiscount();
	}

	@XmlElement
	public TimePeriodDTO getTimePeriod() {
		return discount.getTimePeriod() != null
			? new TimePeriodDTO(discount.getTimePeriod())
			: null;
	}

}
